<?php

namespace App\Http\Controllers\Api;

use App\Http\Controllers\BaseController;
use Illuminate\Http\Request;

class ShareController extends BaseController
{
    public $validate = [
        "upload" => ["rules" => [
            "target_type" => "required|string|max:1000",
        ]],
    ];

    /**
     * @path /share/upload
     * @category 分享
     * @title 分享图上传
     * @method POST
     * @params [{"name":"target_type","type":"text","required":1,"example":"","desc":"主体类型"}]
     * @resBody {"success":true,"statusCode":200,"result":{"result":"1.jpg"},"message":"OK"}
     */
    public function upload(Request $request)
    {
        $params = $request->all();

        $data = service()->ShareService->upload($request, $params['target_type']);

        return $this->apiReturn($data);
    }
}
